﻿using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
                DateTime start = new DateTime();
                DateTime pauseStart = new DateTime();
                TimeSpan result = new TimeSpan();
                TimeSpan split = new TimeSpan();
                Console.WriteLine("press any key to start");
                Console.ReadKey();
                start =  DateTime.Now;
                Console.Clear();
                Console.WriteLine("P-pause");
                Console.WriteLine("Enter - stop");
            if (Console.ReadLine().ToUpper() == "P")
            {
                string proceed = "N";
                do
                {
                    pauseStart = DateTime.Now;
                    split = pauseStart - start;
                    result += split;
                    Console.Clear();
                    if (result == TimeSpan.MinValue) result = pauseStart - start;
                    Console.WriteLine("Result: {0}", result);
                    Console.WriteLine();
                    Console.WriteLine("C-continue");
                    Console.WriteLine("Enter-stop");
                    if (Console.ReadLine().ToUpper() == "C")
                    {
                        start = DateTime.Now;
                        Console.Clear();
                        Console.WriteLine("P-pause");
                        Console.WriteLine("Enter - stop");
                        if (Console.ReadLine().ToUpper() == "P")
                        {
                            proceed = "Y";
                        }
                        else
                        {
                            pauseStart = DateTime.Now;
                            split = pauseStart - start;
                            result += split;
                            proceed = "N";
                        }
                    }
                    else proceed = "N";
                }
                while (proceed == "Y");
            }
            Console.Clear();
            if (pauseStart < start)
            {
                pauseStart = DateTime.Now;
                Console.WriteLine("Result: {0}", pauseStart - start);
            }
            else Console.WriteLine("Result: {0}", result);
            Console.ReadKey();
        }
    }
}
